<template>
  <el-form :model="fromData" :rules="fromData_rules" ref="fromDataRef" label-width="100px">
    <el-form-item label="名称" prop="name">
      <el-input :readonly="_readonly" v-model="fromData.name"></el-input>
    </el-form-item>
    <el-form-item label="描述" prop="remark">
      <el-input type="textarea" :readonly="_readonly" v-model="fromData.remark"></el-input>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  props: {
    fromData: {},
    _readonly: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      fromData_rules: {
        name: [{ required: true, message: '请输入名称', trigger: 'change' }]
      }
    }
  },
  methods: {
    validate() {
      let res_bool = false
      this.$refs.fromDataRef.validate(bool => {
        res_bool = bool
      })
      return res_bool
    },
    resetFields() {
      this.$refs.fromDataRef.resetFields()
      console.log('点表单恢复原状')
    }
  }
}
</script>

<style>
</style>